#ifndef CPLEXHEAD_H
#define CPLEXHEAD_H
#include <ilcplex/cplex.h>
#include <stdlib.h>
#include <string.h>
#include "network.h"
#include <iostream>
#include <map>
using namespace std;
/* The objective of this class is to track the indexes of the cplex matrix */

class cplexhead{
  int E; //nummber of edges
  int C; //number of comodeties
  int N; // number of nodes
  int usez; //1 use Z: 0 dont use
  int NUMCOLS;
 map < string, vector<int> > variabel;
  string last_name;

 public:

  cplexhead(int E,int C,int N);
  int idx_x(int fromnode, int tonode,int com);
  int idx_x(int idx_edge, int com);
  int idx_y(int fromnode, int tonode, int com);
  int idx_y(int idx_edge, int com);
  int idx_z();

  void print();

  void addvar(string name, int length, int active);
  //Get map of starting ind of variabels
  map < string, vector<int> > getmap();
  int mapsize();
  int getmapinfo(string key, int pos);


  /* The map contains: 0: start_index of variable
                       1: end_index+1 of variable
		       2: internal variable indexing
  */
  //Get constant values of the Problem
  int getE();
  int getC();
  int getN();
  int getcols();
  
  //Construktor

};
int solveProblemLP(CPXENVptr env ,CPXLPptr lp,int status,int* solstat, double* objval,double** x);
int solveProblemMIP(CPXENVptr env ,CPXLPptr lp,int status,int* solstat, double* objval,double** x);
  void deleteProblem(CPXENVptr env ,CPXLPptr lp,int status);  
  CPXLPptr makeLp(CPXENVptr env, int status);
  CPXENVptr makeEnv(int status);

#endif
